<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('room/index')}">学生列表</a></li>
			<li><a href="{:url('room/add')}">添加添加</a></li>
			<li class="active"><a>编辑学生</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('student/editpost')}">
			<div class="form-group">
				<label class="col-sm-2 control-label"><span class="form-required">*</span>头像</label>
				<div class="col-md-6 col-sm-10">
					<input id="photo-1" type="hidden" name="image" value="{$stu.image}">
					<input id="photo-1-name" type="text" name="photo_name" title="图片名称">
					<a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
					<img id="photo-1-preview" width="100px" src="/upload/{$stu.image}">
				</div>
			</div>

			<div class="form-group">
				<label for="student_name" class="col-sm-2 control-label"><span class="form-required">*</span>添加学生姓名</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="student_name" name="student_name" value="{$stu.student_name}">
				</div>
			</div>
			<div class="form-group">
				<label for="student_name" class="col-sm-2 control-label"><span class="form-required">*</span>添加学生性别</label>
				<div class="col-md-6 col-sm-10">

					<if $stu.sex == 1>
						<input type="radio" name="sex" value="1" checked>男
						<input type="radio" name="sex" value="2">女
						<else />
						<input type="radio" name="sex" value="1">男
						<input type="radio" name="sex" value="2" checked>女
					</if>


				</div>
			</div>
			<div class="form-group">
				<label for="age" class="col-sm-2 control-label"><span class="form-required">*</span>添加学生年龄</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="age" name="age" value="{$stu.age}">
				</div>
			</div>

			<div class="form-group">
				<label for="idcard" class="col-sm-2 control-label"><span class="form-required">*</span>添加学生身份证号</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="idcard" name="idcard" value="{$stu.idcard}">
				</div>
			</div>

			<div class="form-group">
				<label  class="col-sm-2 control-label"><span class="form-required">*</span>添加学校名称</label>
				<div class="col-md-6 col-sm-10">
					<select name='' class="form-control" id="selectSchool">

						<foreach name="school" item="vo">
							<if $school_id == $vo.id>
								<option value="{$vo.id}" selected>{$vo.school_name}</option>
								<else />
								<option value="{$vo.id}">{$vo.school_name}</option>
							</if>
						</foreach>
					</select>
				</div>
			</div>

			<div class="form-group">
				<label  class="col-sm-2 control-label"><span class="form-required">*</span>添加班级名称</label>
				<div class="col-md-6 col-sm-10">
					<select name='room_id' class="form-control" id="selectRoom">
						<foreach name="room" item="vo">
							<if $stu.room_id == $vo.id>
								<option value="{$vo.id}" selected>{$vo.room_name}</option>
								<else />
								<option value="{$vo.id}">{$vo.room_name}</option>
							</if>
						</foreach>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="selectProvince" class="col-sm-2 control-label"><span class="form-required">*</span>省份</label>
				<div class="col-md-6 col-sm-10">
					<select name='province' class="form-control" id="selectProvince">
						<foreach name="province" item="vo">
							<if $stu.province == $vo.areaId>
								<option value="{$vo.areaId}" selected>{$vo.areaName}</option>
								<else />
								<option value="{$vo.areaId}">{$vo.areaName}</option>
							</if>
						</foreach>

					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="school_name" class="col-sm-2 control-label"><span class="form-required">*</span>市</label>
				<div class="col-md-6 col-sm-10">
					<select name='city' class="form-control" id="selectCity">
						<foreach name="city" item="vo">
							<if $stu.city == $vo.areaId>
								<option value="{$vo.areaId}" selected>{$vo.areaName}</option>
								<else />
								<option value="{$vo.areaId}">{$vo.areaName}</option>
							</if>
						</foreach>

					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="school_name" class="col-sm-2 control-label"><span class="form-required">*</span>区县</label>
				<div class="col-md-6 col-sm-10">
					<select name='district' class="form-control" id="selectDistrict">
						<foreach name="district" item="vo">
							<if $stu.district == $vo.areaId>
								<option value="{$vo.areaId}" selected>{$vo.areaName}</option>
								<else />
								<option value="{$vo.areaId}">{$vo.areaName}</option>
							</if>
						</foreach>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="street" class="col-sm-2 control-label"><span class="form-required">*</span>详细地址</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="street" name="street" value="{$stu.street}">
				</div>
			</div>


			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<!--隐藏域-->
					<input type="hidden" name="id" value="{$stu.id}" />
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
					<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script>
		$(function () {

			$('#selectSchool').change('click',function () {

				var schoolId=$('#selectSchool').val();

				$.ajax({
					url:"{:url('student/getSchool')}",
					type:"POST",
					data:{school_id:schoolId},
					success:function (res) {
						console.log(res);
						$('#selectRoom').html(res);
					}
				});
			});
		})
	</script>
	<script>
		$(function () {

			$('#selectProvince').change('click',function () {

				var areaId=$('#selectProvince').val();

				$.ajax({
					url:"{:url('student/getProvince')}",
					type:"POST",
					data:{areaId:areaId},
					success:function (res) {
						console.log(res);
						$('#selectCity').html(res);
					}
				});
			});
		})
	</script>
	<script>
		$(function () {

			$('#selectCity').change('click',function () {

				var areaId=$('#selectCity').val();

				$.ajax({
					url:"{:url('student/getCity')}",
					type:"POST",
					data:{areaId:areaId},
					success:function (res) {
						console.log(res);
						$('#selectDistrict').html(res);
					}
				});
			});
		})
	</script>
</body>
</html>